<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>     

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"
	rel="stylesheet" />


<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<style type="text/css">
.fieldError {
	color: red;
	text-align: left;
}

.error {
	float: none;
	color: red;
	padding-left: .5em;
	vertical-align: top;
}

table th {
	font-weight: bolder;
	text-align: left;
	background-color: #5599FF;
}
</style>
<script type="text/javascript">

	$(document).ready(function() {
		 $(":input[name=athorityValue]").each(function(){
			 	var aVal=$(this).val();
			 	for(var i=0 ;i<8;i++){
			 		var objVal=$(":checkbox[name='agent.proList["+i+"].mccTypeCode']").val();
			 		if(objVal==aVal){
			 			$(":checkbox[name='agent.proList["+i+"].mccTypeCode']").attr('checked',true);
			 		}
			 	}
			 	 /* $(":checkbox[name=transTypes]").each(function(){
			 		var moduleval=$(this).val();
			 		if(aVal==moduleval){
			 			$(this).attr('checked',true);
			 			
			 		}
			 	}); */
		 	  
		 	});
		//$("input").val("12");
		var mydate=new Date();
		var y=mydate.getFullYear();
		var m=mydate.getMonth()+1; 
		if(m<10){
		   m="0"+m
		}
		var d=mydate.getDate();
		if(d<10){
		   d="0"+d
		}
		$("#curDate").val(y+"-"+m+"-"+d);      
		$("#agentForm").validate({
			debug : true,
			submitHandler : function(form) {
				form.submit();
			},
			rules : {
				"agent.orgCode" : {required : true},
				"agent.agentType" : {required : true},
				"agent.realName" : {required : true},
				"agent.mobile" : {required : true},
				"agent.accountNo" : {required : true},
				"agent.cardType" : {required : true},
				"agent.cardNo" : {required : true},
				"agent.businessPerson":{required:true},
				"agent.businessPhone" : {required : true},
				"agent.bankDeposit" : {required : true},
				"agent.bankAcctName" : {required : true},
				"agent.bankAcctNo" : {required : true},
				"agent.businessScope" : {required : true},
				"agent.address" : {required : true}

			},
			messages : {
				"agent.orgCode" : {required : "必填"},
				"agent.agentType" : {required : "必填"},
				"agent.realName" : {required : "必填"},
				"agent.mobile" : {required : "必填"},
				"agent.accountNo" : {required : "必填"},
				"agent.cardType" : {required : "必填"},
				"agent.cardNo" : {required : "必填"},
				"agent.businessPerson":{required:"必填"},
				"agent.businessPhone" : {required : "必填"},
				"agent.bankDeposit" : {required : "必填"},
				"agent.bankAcctName" : {required : "必填"},
				"agent.bankAcctNo" : {required : "必填"},
				"agent.businessScope" : {required : "必填"},
				"agent.address" : {required : "必填"}
				
			},errorPlacement: function(error, element) { 
			    if ( element.is(":radio") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is(":checkbox") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is("input[name=captcha]") ) 
			        error.appendTo ( element.parent() ); 
			    else 
			        error.insertAfter(element); 
			} 

		});
		
	});
function go(){
     history.go(-1);
}	
</script>
</head>
<body>	
		<div class="subpage">
			<s:form id="agentForm" action="/agentQuery/agentUpdate.ct" method="post"  theme="simple"  >
			 <s:hidden name="agent.flag" value="%{#request.agent.flag}"></s:hidden>
			 
			 <s:iterator value="#request.agent.proList" status="stat" id="bean">
    				<s:hidden name="athorityValue" value="%{#bean.mccTypeCode}"></s:hidden>
   				</s:iterator>
				<div class="user_title">
					<h2 class="headline-inquires">
						POS收单运营管理平台<br />
						<span class="sub-title">
					    <s:hidden name="agent.id" value="%{#request.agent.id}"/>
						</span>
					</h2>
				</div>
				<table width="100%" border="1" cellspacing="0" class="table">
					<tr>
						<td colspan="4" align="center">
							<h2 class="headline-inquires">
								代理商信息变更<br />
								<span class="sub-title"></span>
							</h2>
						</td>
					</tr>
					<tr>
						<td align="right" width="15%">申请人：</td>
						<td align="left"> <s:textfield value="%{#request.op.accountNo}" disabled="true"/> <font color="red">*</font> </td>
						<td align="right" width="15%">日期：</td>
						<td> <s:textfield id="curDate" disabled="true"/> <font color="red">*</font></td>
					</tr>
						<tr>
						<th colspan="4">审核记录</th>
					</tr>
					<tr>
						<td colspan="6">
						<table width="100%">
							<tr>
								<td width="8%">审核操作</td>
								<td width="8%">审核结论</td>
								<td>审核意见</td>
								<td width="10%">审核人员</td>
								<td width="15%">审核时间</td>
							</tr>
							<s:if test="#request.audtingList!=null">
								<s:iterator value="#request.audtingList" var="au">
									<tr>
										<td>
											<s:property value="#au.audit_name"/>
										</td>
										<td>
											<s:property value="#au.resultCodeName"/>
										</td>
										<td >
											<s:property value="#au.result_detail"/>
										</td>
										<td><s:property value="#au.operators"/></td>
										<td>
											<s:date name="#au.dtCreate"/>
										</td>
									</tr>
								</s:iterator>
							</s:if>
							<s:else>无意见</s:else>
						</table>
					</td>
					</tr>
					<tr>
						<th colspan="4">代理商基本信息</th>
					</tr>
					<tr>
					    	<s:if test="#session.session_merchant.roleType==\"00\"||#session.session_merchant.roleType==\"01\"">
						<td align="right" width="15%">角色类别：</td>
						<td>
								<s:select disabled="true" cssClass="queryWidth" name="agent.roleType" id="roleType"
									list="#{'03':'代理商' }" listKey="key" listValue="value"/><font color="red">*</font>
							</td>
						</s:if>
						<s:else>
						<td align="right" width="15%">角色类别：</td>
							<td>
								<s:select disabled="true" cssClass="queryWidth" name="agent.roleType" id="roleType"
									list="#{'03':'代理商' }" listKey="key" listValue="value"/><font color="red">*</font>
							</td>
						</s:else>
					
						 <s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
							<td align="right" width="15%"></td>
							<td>
							  <s:hidden name="agent.orgCode" value="%{#request.agent.orgCode}" />
							</td>
					    </s:if>
					    <s:else>
					      <td align="right" width="15%">所属机构：</td>
						  <td>
								<s:select disabled="true" cssClass="queryWidth" name="agent.orgCode" id="orgCode"
									list="#request.orgList" listKey="org_code" listValue="org_name"/><font color="red">*</font>
						 </td>
					    </s:else>
					
						
							
						</tr>
					  <tr>
						<td align="right" width="15%">代理商类别：</td>
						<td>
							<s:select disabled="true" cssClass="queryWidth" name="agent.agentType"  value="%{#request.agent.agentType}"
								list="#request.agTypeList" listKey="key" listValue="value"/><font color="red">*</font>
						 </td>
						<td align="right" width="15%">甲方名称：</td>
						<td align="left" ><s:textfield maxlength="15" name="agent.realName" value="%{#request.agent.realName}" cssClass="queryWidth"/><font color="red">*</font> </td>
						</tr>
					   <tr>
						<td align="right" width="15%">登录账号：</td>
						<td><s:textfield disabled="true" maxlength="30" name="agent.accountNo" value="%{#request.agent.accountNo}" cssClass="queryWidth"/><font color="red">*</font> </td>
						<td align="right" width="15%">手机号：</td>
						<td><s:textfield maxlength="11" name="agent.mobile" value="%{#request.agent.mobile}" cssClass="queryWidth" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td align="right" width="15%">证件类型：</td>
						
						<td>
							<s:select cssClass="queryWidth" name="agent.cardType" value="%{#request.agent.cardType}" id="cardType"
								list="#{'01':'身份证','02':'护照','03':'军官证','04':'驾照','05':'其他' }" /><font color="red">*</font>
						 </td>
						<td align="right" width="15%">证件号码：</td>
						
						<td><s:textfield maxlength="50" name="agent.cardNo" value="%{#request.agent.cardNo}" cssClass="queryWidth" /> <font color="red">*</font></td>
					</tr>
					<tr>
						<td align="right" width="15%">业务联系人：</td>
						
						<td><s:textfield maxlength="9" name="agent.businessPerson" value="%{#request.agent.businessPerson}" cssClass="queryWidth"/><font color="red">*</font> </td>
						<td  align="right" width="15%">业务联系人电话：</td>
						
						<td ><s:textfield maxlength="11" name="agent.businessPhone" value="%{#request.agent.businessPhone}" cssClass="queryWidth" /><font color="red">*</font> </td>
					</tr>
					
					<tr>
						<td align="right" width="15%">营业执照号：</td>
						
						<td><s:textfield maxlength="35" name="agent.businessLicences" value="%{#request.agent.businessLicences}" cssClass="queryWidth"/> </td>
						<td align="right" width="15%">税务登记号：</td>
						
						<td><s:textfield maxlength="35" name="agent.taxRegistrationCertificate" value="%{#request.agent.taxRegistrationCertificate}" cssClass="queryWidth" /> </td>
					</tr>
					<tr>
						<td align="right" width="15%">组织机构代码：</td>
						
						<td><s:textfield  maxlength="35" name="agent.organizationCode" value ="%{#request.agent.organizationCode}" cssClass="queryWidth"/> </td>
						<td colspan="2">&nbsp;</td>
					</tr>
					<tr>
						<td align="right" width="15%">开户行：</td>
						
						<td><s:textfield maxlength="50" name="agent.bankDeposit" value="%{#request.agent.bankDeposit}" cssClass="queryWidth"/> <font color="red">*</font></td>
						<td align="right" width="15%">账户名称：</td>
						
						<td><s:textfield maxlength="9" name="agent.bankAcctName" value="%{#request.agent.bankAcctName}" cssClass="queryWidth" /><font color="red">*</font> </td>
					</tr>
					<tr>
						<td align="right" width="15%">银行账户：</td>
						
						<td><s:textfield maxlength="19" name="agent.bankAcctNo" value="%{#request.agent.bankAcctNo}" cssClass="queryWidth"/> <font color="red">*</font></td>
						<td align="right" width="15%">业务联系QQ：</td>
						
						<td><s:textfield maxlength="11" name="agent.qq" value="%{#request.agent.qq}"  cssClass="queryWidth" /> </td>
					</tr>
					<tr>
						<td align="right" width="15%">电话号码：</td>
						
						<td><s:textfield maxlength="15" name="agent.telphone" value="%{#request.agent.telphone}" cssClass="queryWidth"/> </td>
						<td align="right" width="15%">邮箱地址：</td>
						
						<td><s:textfield maxlength="50" name="agent.email" value="%{#request.agent.email}" cssClass="queryWidth" /> </td>
					</tr>
					<tr>
						<td align="right" width="15%">性别：</td>
						<td>
							<s:radio name="agent.sex" list="#{'1':'男','0':'女' }" value="%{#request.agent.sex}"></s:radio>
						 </td>
						 <td align="right" width="15%">邮政编码：</td>
						
						<td><s:textfield maxlength="6" name="agent.zipeCode" value="%{#request.agent.zipeCode}" cssClass="queryWidth" /> </td>
					</tr>
					<tr>
						<td align="right" width="15%">经营范围：</td>
						<td colspan="3"><s:textfield maxLength="65" name="agent.businessScope" value="%{#request.agent.businessScope}" cssStyle="width:95%;"></s:textfield><font
							color="red">*</font></td>
					</tr>
					<tr>
						<td align="right" width="15%">详细地址：</td>
						<td colspan="3"><s:textfield maxLength="64" name="agent.address" value="%{#request.agent.address}" cssStyle="width:95%;"></s:textfield><font color="red">*</font></td>
					</tr>
					<tr>
						<td align="right" width="15%">备注：</td>
						<td colspan="3"><s:textarea rows="5"  cssStyle="width:95%;" name="agent.remark" value="%{#request.agent.remark}" maxlength="64"/></td>
					</tr>
					<tr>
						<th colspan="4">代理商拓展范围</th>
					</tr>
					<tr>
						<td colspan="4">
							<table  width="100%">
								<tr>
									<td width="30%">拓展行业</td>
									<td  width="15%">代理商结算费率</td>
									<td  width="15%">代理商分润比例</td>
									<td  width="20%">封顶</td>
									<td  width="20%">商户最低费率</td>
								</tr>
								<s:iterator value="#request.mccList" var="a" status="stat">
									<tr>
										<td align="left">
											<s:checkboxlist name="agent.proList[%{#stat.index}].mccTypeCode"  list="#{#a.key:''}" theme="simple"></s:checkboxlist>
											<s:property value="#a.value"/><s:property value="#a.key"/>
											
											<!--hidden-->
											<s:hidden value="%{#a.key}" id="test%{#a.key}"></s:hidden>											
										</td>
										<td><s:textfield   name="agent.proList[%{#stat.index}].profitFee" value="%{#request.agent.proList[#stat.index].profitFee}" cssStyle="width:70%" />% </td>
										<td><s:textfield  name="agent.proList[%{#stat.index}].profitSettleRate" value="%{#request.agent.proList[#stat.index].profitSettleRate}" cssStyle="width:70%" />%</td>
										<td>
										
											 <s:if test=" #a.key!=\"06\"   &&  #a.key!=\"08\"">
											 	<s:textfield  name="agent.proList[%{#stat.index}].maxFee" value="%{#request.agent.proList[#stat.index].maxFee}" cssStyle="width:70%;background-color:lightgray;" readonly="true" />元
											 </s:if>
											 <s:else>
											 	<s:textfield  name="agent.proList[%{#stat.index}].maxFee" value="%{#request.agent.proList[#stat.index].maxFee}" cssStyle="width:70%" />元
											 </s:else>
										</td>	 
											
										<td><s:textfield  name="agent.proList[%{#stat.index}].merchantMinFee" value="%{#request.agent.proList[#stat.index].merchantMinFee}" cssStyle="width:70%"  />%</td>
									</tr>
								</s:iterator>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="4"><s:submit id="btnAdd" value="保  存"/> &nbsp;&nbsp; 
						<input type="reset"  value="取   消"/> &nbsp;&nbsp;
						<input type="button"  onclick="go()" value="返  回"/></td>
					</tr>
					<tr>
						<td align="center" colspan="4">
						&nbsp;
						</td>
					</tr>
				</table>

			</s:form>
		</div>
	
</body>
</html>
